package com.neusoft.demo.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.neusoft.demo.dao.OrderMapper;
import com.neusoft.demo.po.Goods;
import com.neusoft.demo.po.Order;

@Service
@Transactional
public class OrderService {
	
	@Autowired
	OrderMapper mapper;
	
	
	public List<Order> findByUserId(Order order) {
		//在底层封装对象(mapperStatment)执行执行sql语句之前，启用分页插件注入分页语句。
		PageHelper.startPage(1,4);
		List<Order> list = mapper.findByUserId(order);
		return list;
	}
	
	public List<Goods> findByOrderCode(Order order) {
		PageHelper.startPage(1,4);
		List<Goods> list = mapper.findByOrderCode(order);
		return list;
	}
	
	public boolean alterStatus(Order order){
		boolean b = mapper.alterStatus(order);
		return b;
	}
	
	public boolean deleteOrders(Order order){
		boolean b = mapper.alterVisible(order);
		return b;
	}
}
